--SELECT document_type, version, manufacturer
--
--FROM sys.fulltext_document_types


USE CC_CX --replace with correct DB name

GO

IF OBJECT_ID (N'StormyWeather', N'U') IS NOT NULL

DROP TABLE StormyWeather

GO

CREATE TABLE StormyWeather (

  StormID INT NOT NULL IDENTITY,

  StormHead NVARCHAR(50) NOT NULL,

  StormBody NVARCHAR(MAX) NOT NULL,

  CONSTRAINT [PK_StormyWeather_StormID] PRIMARY KEY CLUSTERED (StormID ASC)

)

GO

-- Populate the StormyWeather table with data

-- that supports various full-text query types.

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Stormy Weather Delays Travel',

  'The stormy weather made travel by motor vehicle difficult.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Stormier Weather on Monday',

  'The stormier weather on Monday made vehicle travel difficult.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Stormiest Weather in December',

  'December can be the stormiest month, making automobile travel difficult.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Storm Grows Strong',

  'The storm is growing strong.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Storms Crossing the Pacific',

  'The storms are lining up across the Pacific Ocean.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Storm''s Wind Delays Travel',

  'The storm''s wind made car travel difficult on Tuesday.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Storms'' Flooding Delays Travel',

  'The storms'' flooding made auto travel difficult throughout December.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Children Run from Room',

  'The children often storm out of the room when upset.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Boy Runs from Room',

  'The boy storms out of the room when his sister changes the channel.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Girl Ran from Room',

  'The girl stormed out of the room when her brother ate the cookie.')

INSERT INTO StormyWeather (StormHead, StormBody)

VALUES('Children Running from Room',

  'The children were storming out of the room when the lights went out.')

GO

-- Create a full-text catalog and set it as the default.

CREATE FULLTEXT CATALOG ftcStormyWeather

AS DEFAULT

GO

-- Create a full-text index on the StormyWeather table.

-- Add the index to the ftcStormyWeather catalog.

CREATE FULLTEXT INDEX ON StormyWeather(StormHead, StormBody)

KEY INDEX PK_StormyWeather_StormID

ON ftcStormyWeather

GO

SELECT StormID, StormHead,  StormBody FROM StormyWeather

WHERE CONTAINS(StormHead, 'storm')

SELECT StormID, StormHead,  StormBody FROM StormyWeather

WHERE CONTAINS((StormHead, StormBody), 'storm')

SELECT StormID, StormHead,  StormBody FROM StormyWeather

WHERE CONTAINS(*, 'storm')

SELECT StormID, StormHead,  StormBody FROM StormyWeather

WHERE CONTAINS(StormHead, '"storm" OR "storms" OR "stormy" OR "stormier" OR "stormiest"')

SELECT StormID, StormHead,  StormBody FROM StormyWeather

WHERE CONTAINS(StormHead, '"storm*"') 

SELECT StormID, StormHead,  StormBody FROM StormyWeather

WHERE CONTAINS(StormHead, 'FORMSOF(INFLECTIONAL, run)')

SELECT StormID, StormHead,  StormBody FROM StormyWeather

WHERE CONTAINS(StormBody, 'FORMSOF(THESAURUS, car)')